<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue使用之子父组件传值</title>
    <script src="../vue.min.js" type="text/javascript"></script>
</head>
<body>
<div id="app">
    <boy-component @child="accept"></boy-component>
</div>

<script type="text/javascript">
    var boyComponent = {
        template: `<button @click="send">发送</button>`,
        data(){
            return {
                info:'hello,父组件'
            }
        },
        methods: {
            send:function () {
                this.$emit('child',this.info)
            }
        }
    }

    var app=new Vue({
        el: '#app',
        components:{
            boyComponent
        },
        methods: {
            accept:function(info){
                console.log(info)
            }
        }
    })
</script>
</body>
</html>